package com.chapter08;

import org.apache.commons.dbcp.BasicDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class Test03_dbcp {
    public static void main(String[] args) throws SQLException {
        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/myschool?rewriteBatchedStatements=true");
        dataSource.setPassword("root");
        dataSource.setUsername("root");

        dataSource.setMaxActive(10);
        dataSource.setInitialSize(3);

        Connection connection = dataSource.getConnection();
        System.out.println(connection.getClass().getName());
    }
}
